Code Snippets

Code Snippets provide an easy way for you to insert reusable code into editor when writing statements or scripts. The Code Snippet pane is on the right side of the editor.

The library includes built-in and user-defined snippets. Choose a label from the drop-down list or enter a search string in the Search box to filter the list. If you want to show the available snippets according to your database type, you can control-click anywhere on the library and disable Show Snippets For Other Database Type.

Built-in snippets are non-editable. A user-defined snippet can be edited by double-clicking it in the library. If you want to hide the built-in snippets, you can control-click anywhere on the library and disable Show Preset Snippets.

Use Code Snippets

There are two ways to insert a snippet into the editor.

After inserting the snippet with placeholders to the editor, you can easily navigate to them by clicking on one of the placeholders, and then using the TAB key and entering the information.

Create Code Snippets

You can create your own code snippets and add them to the library. To create a code snippet, select your desired code in the editor, then control-click and select Create Snippet.

Alternatively, click New Snippet in the Code Snippet pane. If you use this method, you must manually enter the code in the New Snippet window; code selected in the editor is not automatically added to the Code box.

Hint: Code snippets (.nsnippet) are stored under the default path, e.g. ~/Library/Application Support/PremiumSoft CyberTech/Navicat CC/Common/Snippet.

Option / Button

Description

Untitled text box

Enter the name of the snippet that displays in the library and the code completion list.

Database Type

Choose the database server type of the snippet.

Label

Choose an existing label or enter a new label name for the snippet.

Remarks

Enter a description for the snippet that displays in the library.

Code

Enter the code.

Add Placeholder

Add a placeholder by highlighting any words in the code and click this button. The placeholder will be highlighted in light green.

Remove Placeholder

Remove a placeholder by highlighting it in the code and click this button.

Move / Copy Snippet To Project

If you have logged in to Navicat Cloud or On-Prem Server, you can synchronize the custom snippet in My Connections to a project.

Hint: You can move / copy a snippet in a project to My Connections in a similar way.